package com.white.movies.Domains

import android.os.Parcel
import android.os.Parcelable

data class MoviesBean(
    var Banners: ArrayList<Banner> = arrayListOf(),
    var Items: ArrayList<Item> = arrayListOf(),
    var Upcommings: ArrayList<Upcomming> = arrayListOf()
) {
    data class Banner(
        var age: String = "", // +13
        var genre: String = "", // War Action Adventure
        var image: String = "", // wide.jpg
        var name: String = "", // 1917
        var time: String = "", // 2 Hour
        var year: String = "" // 2023
    )

    data class Item(
        var Casts: List<Cast>? = listOf(),
        var Description: String? = "", // A young woman with a mysterious past is tasked with uniting different tribes to fight against an oppressive warlord who threatens their peaceful colony.
        var Genre: List<String>? = listOf(),
        var Imdb: Double = 0.0, // 8.3
        var Poster: String? = "", // w1.jpg
        var Time: String? = "", // 2h 22m
        var Title: String? = "", // Rebel Moon
        var Trailer: String? = "", // https://www.youtube.com/watch?v=UEJuNHOd8Dw
        var Year: Int = 0 // 2023
    ) : Parcelable {
        constructor(parcel: Parcel) : this(
            parcel.createTypedArrayList(Cast),
            parcel.readString(),
            parcel.createStringArrayList(),
            parcel.readDouble(),
            parcel.readString(),
            parcel.readString(),
            parcel.readString(),
            parcel.readString(),
            parcel.readInt()
        ) {
        }

        data class Cast(
            var Actor: String? = "", // Sofia Boutella
            var PicUrl: String? = "" // Sofia-Boutella.png
        ) : Parcelable {
            constructor(parcel: Parcel) : this(
                parcel.readString(),
                parcel.readString()
            ) {
            }

            override fun writeToParcel(parcel: Parcel, flags: Int) {
                parcel.writeString(Actor)
                parcel.writeString(PicUrl)
            }

            override fun describeContents(): Int {
                return 0
            }

            companion object CREATOR : Parcelable.Creator<Cast> {
                override fun createFromParcel(parcel: Parcel): Cast {
                    return Cast(parcel)
                }

                override fun newArray(size: Int): Array<Cast?> {
                    return arrayOfNulls(size)
                }
            }

        }

        override fun writeToParcel(parcel: Parcel, flags: Int) {
            parcel.writeTypedList(Casts)
            parcel.writeString(Description)
            parcel.writeStringList(Genre)
            parcel.writeDouble(Imdb)
            parcel.writeString(Poster)
            parcel.writeString(Time)
            parcel.writeString(Title)
            parcel.writeString(Trailer)
            parcel.writeInt(Year)
        }

        override fun describeContents(): Int {
            return 0
        }

        companion object CREATOR : Parcelable.Creator<Item> {
            override fun createFromParcel(parcel: Parcel): Item {
                return Item(parcel)
            }

            override fun newArray(size: Int): Array<Item?> {
                return arrayOfNulls(size)
            }
        }
    }

    data class Upcomming(
        var Casts: List<Cast>? = listOf(),
        var Description: String? = "", // A young man named D'Artagnan travels to Paris to become a musketeer and joins forces with Athos, Porthos, and Aramis to stop a plot to overthrow the king.
        var Genre: List<String>? = listOf(),
        var Imdb: Double = 0.0, // 8.2
        var Poster: String? = "", // w6.jpg
        var Time: String? = "", // 2h 7m
        var Title: String? = "", // The Three Musketeers
        var Trailer: String? = "", // https://www.youtube.com/watch?v=FsuJMqePZtg
        var Year: Int = 0 // 2023
    ) : Parcelable {
        constructor(parcel: Parcel) : this(
            parcel.createTypedArrayList(Cast),
            parcel.readString(),
            parcel.createStringArrayList(),
            parcel.readDouble(),
            parcel.readString(),
            parcel.readString(),
            parcel.readString(),
            parcel.readString(),
            parcel.readInt()
        ) {
        }

        data class Cast(
            var Actor: String? = "", // Fran ois Civil
            var PicUrl: String? = "" // Fran%C3%A7ois-Civil.png
        ) : Parcelable {
            constructor(parcel: Parcel) : this(
                parcel.readString(),
                parcel.readString()
            ) {
            }

            override fun writeToParcel(parcel: Parcel, flags: Int) {
                parcel.writeString(Actor)
                parcel.writeString(PicUrl)
            }

            override fun describeContents(): Int {
                return 0
            }

            companion object CREATOR : Parcelable.Creator<Cast> {
                override fun createFromParcel(parcel: Parcel): Cast {
                    return Cast(parcel)
                }

                override fun newArray(size: Int): Array<Cast?> {
                    return arrayOfNulls(size)
                }
            }
        }

        override fun writeToParcel(parcel: Parcel, flags: Int) {
            parcel.writeTypedList(Casts)
            parcel.writeString(Description)
            parcel.writeStringList(Genre)
            parcel.writeDouble(Imdb)
            parcel.writeString(Poster)
            parcel.writeString(Time)
            parcel.writeString(Title)
            parcel.writeString(Trailer)
            parcel.writeInt(Year)
        }

        override fun describeContents(): Int {
            return 0
        }

        companion object CREATOR : Parcelable.Creator<Upcomming> {
            override fun createFromParcel(parcel: Parcel): Upcomming {
                return Upcomming(parcel)
            }

            override fun newArray(size: Int): Array<Upcomming?> {
                return arrayOfNulls(size)
            }
        }
    }
}